package com.zs.service.impl;

import com.zs.dao.NewsDao;
import com.zs.factory.SimpleFactory;
import com.zs.pojo.News;
import com.zs.service.NewsService;

/**
 * @author ZhouShuang
 * @version 17
 * @Title
 * @date 2025/6/10 上午10:09
 */
public class NewsServiceImpl implements NewsService {
    //所依赖的NewsDao对象
//    private NewsDao dao = SimpleFactory.getInstance();
    private NewsDao dao;

    public void setDao(NewsDao dao){
        this.dao = dao;
    }
    /**
     * 新增新闻信息
     * @param news
     */
    @Override
    public void addNews(News news) {
        //调用NewsDao的方法保存新闻信息
        dao.save(news);
    }
}
